<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns=" http://www.w3.org/1999/xhtml">
	<head>
		<base href="<%=basePath%>">
		<title>创建个人档案</title>
		<link href="themes/css/ui.common.css" rel="stylesheet"
			type="text/css" />
		<link href="themes/css/ui.child.css" rel="stylesheet"
			type="text/css" />
		<link href="themes/css/ui.tips.css" rel="stylesheet"
			type="text/css" />
		<link href="style/jquery_ui/jquery-ui-1.8.custom.css"
			rel="stylesheet" type="text/css" />
		<link id="skin_css" rel="stylesheet" type="text/css"
			href="themes/css/ui.c.blue.css" />
		<link href="style/mailSender.css" rel="stylesheet"
			type="text/css" />
	<link rel="stylesheet" href="themes/css/ui.validation.css" type="text/css"></link>
		<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
		<script src="Scripts/jquery.json-2.2.min.js"
			type="text/javascript"></script>
		<script src="Scripts/jquery-ui-1.8.custom.min.js"
			type="text/javascript"></script>
		<script src="Scripts/ui.default.js " type="text/javascript"
			charset="UTF-8"></script>
		<script src="Scripts/ui.admincp.js" type="text/javascript"
			charset="UTF-8"></script>
			
	<script type="text/javascript" src="Scripts/ui.validation.js"></script>
	 
		<style type="text/css">
		.text-align-right {
			text-align: right;
			padding-right: 2px;
			font-weight: bolder;
		}

		.text-control-left {
			text-align: left;
			width: 200px;
		}

		.control-width-180 {
			width: 180px;
		}

		.control-width-80 {
			width: 80px;
		}

		.input-control {
			border: 0;
			height: 24px;
			padding: 2px;
		}

		.td-width-100 {
			text-align: left;
			width: 100px;
		}

		.td-width-100 {
			width: 120px;
		}

		.style1 {
	
		}

		.input-big-text {
			width: 635px;
			height: 100px;
		}

		td {
			padding: 2px;
		}
	</style>
	<SCRIPT type="text/javascript">
	$(function () {
	setValidate();
    $("#age").numeral();
    switcher();

    $.post("archivesInfo!queryArchiveNo.action", null,
			function (data) {
			    if (data != '') {
			        $("#txt_archiveNo").val(data);
			        $("#archiveNo").val(data);
			    } else {
			        $("#txt_archiveNo").val('生成失败');
			        $("#archiveNo").val('0');
			    }
			}, "html");
    });
    
     	function setValidate(){
    
    	 $("#form").validatingForm({
        	submitButtonId:"#btnSubmit",
        	  clearErrorsOnFocus:true,
        	 validateOnBlur:true
        	});
    	}


	function switcher() {
    $("#sectionSelector").change(function () {
        var sectionId = $(this).val();
        $.post("archivesInfo!queryPostBySection.action", { "sectionId": sectionId }, function (data) {
            if (data != '')
            //对应的物资信息添加到select中
                $("#postSelector").html("").append(data);
            else
                $("#postSelector").html("").append("<option value=\"-1\">-请先选择部门-</option>");
        }, "html");
    });

    $("#txt_staffNo").change(function () {
        var staffNo = $(this).val();
        $.post("archivesInfo!verifyStaffNo.action", { "staffNo": staffNo }, function (data) {
            if (data == '1') {
                alert("警告:该学号已存在!");
                $("#txt_staffNo").val('');
                $("#txt_staffNo").focus();
            }
        }, "text");
    }); 
}

function clearPostSelector() {
    location = "archivesInfo.action";
}
	</SCRIPT>
</head>
	<body>
		<div class="PageChild_Title">
			<img src="themes/images/default/icons/archives.png" class="PageChild_Tbtnpic" />
			<span class="PageChild_separate"></span>
			<span class="PageChild_TbtnText"><h2>创建人员档案</h2></span>
			<span class="PageChild_separate"></span>
			<div id="marker" class="red-tips">
			</div>
			<div class="clear">
			</div>
		</div>
		&nbsp;
		<form action="archivesInfo!add.action" method="post">
		<table  id="form" style="border: 1px solid gray; padding: 1px;" border="0"
			cellpadding="0" cellspacing="0" align="center">
			<tr>
				<td colspan="4" align="center">
					<s:if test="str != null"><FONT color="red">${str}</FONT></s:if>
				</td>
			</tr>
			<tr>
				<td colspan="4" align="center">
					<input id="archiveNo" name="archiveNo" value="${archiveNo}" type="hidden">&nbsp;
				</td>
			</tr>
			<tr>
				<td class="text-align-right" style="width: 80px;">
					&nbsp;学号:
				</td>
				<td style="width: 100px" valign="middle" class="style1">
					<input id="txt_staffNo" name="staffNo" class="control-width-100 required-field no-Chinese-field input-control clearable" value="${staffNo}">
				</td>
				<td class="text-align-right" style="width: 80px;">
					&nbsp;密码:
				</td>
				<td style="width: 220px" valign="middle" class="style1">
					<input name="staffPwd" class="control-width-100 input-control clearable" value="123456" disabled="disabled">&nbsp;默认值
				</td>
			</tr>
			<tr>
				<td class="text-align-right" style="width: 80px;">
					&nbsp; 姓名:
				</td>
				<td style="width: 100px" valign="middle" class="style1">
					<input id="staffName" name="staffName" class="control-width-100 required-field  input-control clearable" value="${staffName}">
				</td>
				<td class="text-align-right" style="width: 80px;">
					&nbsp;性别:
				</td>
				<td style="width: 220px" class="style1">
					<s:select list="#{'男':'男','女':'女'}" name="gender" theme="simple" cssClass="control-width-40 clearable" cssStyle="width: 152px; height: 26px"></s:select>
				</td>
			</tr>
			<tr>
				<td class="text-align-right">
					&nbsp;年龄:
				</td>
				<td class="style1">
					<input id="age" name="age" max="60" min="16" class="control-width-100 betweenvalue-field required-field  input-control clearable" value="${age}">
				</td>
				<td class="text-align-right">
					&nbsp;生日:
				</td>
				<td class="style1">
					<input id="birthday" name="birthday" class="control-width-100 required-field input-control NeedDate" value="${birthday}">
				</td>
			</tr>
			<tr>
				<td class="text-align-right">
					&nbsp;政治面貌:
				</td>
				<td class="style1">
					<s:select list="#{'团员':'团员','预备党员':'预备党员','党员':'党员','群众':'群众'}" name="politician" theme="simple" cssClass="control-width-40 clearable" cssStyle="width: 152px; height: 26px"></s:select>
				</td>
				<td class="text-align-right">
					&nbsp;年级:
				</td>
				<td class="style1">
					 <input id="grade" name="grade" class="control-width-100 required-field   input-control clearable" value="${grade}">
				</td>
			</tr>
			<tr>
				<td class="text-align-right">
					&nbsp;专业:
				</td>
				<td class="style1">
					<s:select id="majorList" list="majorList" listKey="majorId" listValue="majorName" headerKey="-1" headerValue="-请选择-" name="majorId" theme="simple" emptyValueMsg="请选择专业。" emptyValueForValidate="-1" cssClass="selectable-field control-width-40 clearable" cssStyle="width: 152px; height: 26px"></s:select>
				</td>
				<td class="text-align-right">
					&nbsp;班级:
				</td>
				<td class="style1">
					<input id="classNo" name="classNo" class="control-width-100 required-field input-control clearable" value="${classNo}">
				</td>
			</tr>
			<tr>
				<td class="text-align-right">
					&nbsp;联系电话:
				</td>
				<td class="style1">
					<input id="telphone" name="telphone" class="control-width-100 telphone-field input-control clearable" value="${telphone}">
				</td>
				<td class="text-align-right">
					&nbsp;人员邮箱:
				</td>
				<td class="style1">
					<input id="mail" name="mail" class="control-width-100 email-field input-control clearable" value="${mail}">
				</td>
			</tr>
			<tr>
				<td class="text-align-right">
					&nbsp;寝室地址:
				</td>
				<td class="style1">
					<input id="dormitory" name="dormitory" class="control-width-100 required-field input-control clearable" value="${dormitory}">
				</td>
				<td class="text-align-right">
					&nbsp;档案编号:
				</td>
				<td class="style1">
					<input id="txt_archiveNo" class="control-width-100 no-Chinese-field required-field input-control clearable" value="${archiveNo}" disabled="disabled">
				</td>
			</tr>
			<tr>
				<td class="text-align-right">
					&nbsp;所在部门:
				</td>
				<td class="style1">
					<s:select list="sectionList" listKey="sectionId" listValue="sectionName" id="sectionSelector" headerKey="" headerValue="-请选择-" name="sectionId" theme="simple" cssClass="control-width-40 clearable" cssStyle="width: 152px; height: 26px" value="sectionId"></s:select>
				</td>
				<td class="text-align-right">
					&nbsp;所在职位:
				</td>
				<td class="style1">
                	<s:select list="#{'-1':'-请先选择部门-'}" name="postId" id="postSelector" theme="simple" emptyValueMsg="请选择职位。" emptyValueForValidate="-1" cssClass="control-width-40 clearable input-control selectable-field" cssStyle="width: 152px; height: 26px"></s:select>
				</td>
			</tr>
			<tr>
				<td colspan="4" align="center">
					&nbsp;
				</td>
			</tr>
			<tr>
				<td colspan="4" align="center">
					<input id="btnSubmit" type="submit" class="o-btn" value="提交" />
					&nbsp;
					<input id="btnReset" type="reset" value="重置" class="o-btn"
						onclick="clearPostSelector();" />
				</td>
			</tr>
			<tr>
				<td colspan="4" align="center">
					&nbsp;
				</td>
			</tr>
		</table>
		</form>
		<div id="errorSummary"></div>
		
	</body>
</html>